package com.drore.cloud.sdkjdbc.model;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/***
 * 浙江卓锐科技股份有限公司 版权所有@Copyright 2016
 * 说明
 * 项目名称
 * @since:cloud-ims 1.0
 * @author <a href="mailto:baoec@drore.com">baoec@drore.com </a> 
 * 2018/06/21 15:55
 */

public class QueryParam {
    private Integer current_page=1;
    private Integer page_size=10;
    /***
     * 排序
     */
    private LinkedHashMap<String, Object> sort=new LinkedHashMap<String, Object>();
    private Param param;

    public Param getParam() {
        return param;
    }

    public void setParam(Param param) {
        this.param = param;
    }

    /***
     * 查询条件对象
     */
    public static class Param{
        /***
         * 完全匹配，类似于=
         */
        private Map<String, Object> term=new HashMap<String, Object>();
        /***
         * 模糊查询
         */
        private Map<String, Object> fuzzy=new HashMap<String, Object>();
        /***
         * 某区间范围内,使用->作为区间符号，如1->10
         */
        private Map<String, Object> range=new HashMap<String, Object>();
        public Map<String, Object> getTerm() {
            return term;
        }

        public void setTerm(Map<String, Object> term) {
            this.term = term;
        }

        public Map<String, Object> getFuzzy() {
            return fuzzy;
        }

        public void setFuzzy(Map<String, Object> fuzzy) {
            this.fuzzy = fuzzy;
        }

        public Map<String, Object> getRange() {
            return range;
        }

        public void setRange(Map<String, Object> range) {
            this.range = range;
        }
        public Integer getParamSize(){
            Integer size=this.term.size()+this.fuzzy.size()+this.range.size();
            return size;
        }
    }




    /***
     * 新增增加排序方法
     * @param key
     * @param value
     */
    public QueryParam addSort(String key,Object value){
        sort.put(key,value);
        return this;
    }
    public LinkedHashMap<String, Object> getSort() {
        return sort;
    }

    public void setSort(LinkedHashMap<String, Object> sort) {
        this.sort = sort;
    }



    public Integer getCurrent_page() {
        return current_page;
    }

    public void setCurrent_page(Integer current_page) {
        this.current_page = current_page;
    }

    public Integer getPage_size() {
        return page_size;
    }

    public void setPage_size(Integer page_size) {
        this.page_size = page_size;
    }

    public QueryParam (){}

    public QueryParam (Integer current_page,Integer page_size){
        this.current_page=current_page;
        this.page_size=page_size;
    }


}
